package com.dwaynema.util;

import com.dwaynema.common.RestResult;
import com.dwaynema.common.RestResultEnum;

import java.util.List;

public class RestResultUtil {


    public static RestResult restResult=null;
    public static RestResult result(RestResultEnum restResultEnum , String string, List<Object> object){
        restResult =new RestResult(restResultEnum.value,string,object);
        restResult.setCode(restResultEnum.value);
        restResult.setMsg(string);
        if(object!=null){
            restResult.setData(object);
        }

        return restResult;
    }

    public static RestResult result(RestResultEnum restResultEnum,String string,Object object){
        restResult=new RestResult(restResultEnum.value,string,object);
        restResult.setCode(restResultEnum.value);
        restResult.setMsg(string);
        if(object!=null){
            restResult.setObject(object);
        }
        return restResult;
    }
}
